package org.example.IO;

import java.io.File;
import java.io.IOException;

/**
 * @className: Demo2
 * @author: 芃
 * @description: 创建文件
 * @date: 2024/5/6 14:52
 */
public class Demo2 {
    public static void main(String[] args) throws IOException {
        File file = new File("./test.txt");
        System.out.println(file.exists());
        System.out.println(file.isDirectory());//是否是目录
        System.out.println(file.isFile()); //是否是文件
        System.out.println("创建文件~");
        file.createNewFile();
        System.out.println("创建文件结束");
        System.out.println(file.exists());
        System.out.println(file.isDirectory());
        System.out.println(file.isFile());
    }
}
